package com.cskaoyan.javase.oop2._1extends._7initialization._2classload;

/**
 * 触发子类类加载会优先触发父类类加载, 而且是从顶层父类开始,自上往下的
 * @since 09:33
 * @author wuguidong@cskaoyan.onaliyun.com
 */
public class Demo {
    public static void main(String[] args) {
        // new Son();
        // new Father();
        // System.out.println(Father.num);
        new Grandfather();
    }
}

class Grandfather {
    static {
        System.out.println("1");
    }
}

class Father extends Grandfather {
    static int num = 100;
    static {
        System.out.println("2");
    }
}

class Son extends Father {
    static {
        System.out.println("3");
    }
}